import { getProcessElTrueData } from './auth'
/**
 *
 * @param thisObj
 * @param globalData
 * @param keySrc list,btn,form 其中之一
 * @param key
 * @returns {{}}
 */
export function hasModalFn(thisObj, globalData, keySrc, key) {
  const srcLabel = thisObj.initSrcObj.initSrcLabel
  const tmpObj = {}
  tmpObj[key] = true
  if (srcLabel === undefined) {
    return tmpObj
  }
  if (thisObj.initUiVal.modalFn !== undefined) {
    if (thisObj.initUiVal.modalFn[srcLabel]) {
      const keyFnObj = thisObj.initUiVal.modalFn[srcLabel][keySrc]
      if (keyFnObj !== undefined) {
        const dataList = keyFnObj[key]
        if (dataList === undefined) {
          // 没配置 读写
          tmpObj[key] = false
        } else {
          const elObj = getProcessElTrueData(thisObj, key, dataList, globalData, true)
          if (elObj[key]) {
            // 配置的时只读属性
            tmpObj[key] = true
          } else {
            tmpObj[key] = false
          }
        }
      }
    }
  }
  return tmpObj
}
